/*
 *  Mach-O object file loading
 *
 *  Copyright (c) 2006 Pierre d'Herbemont
 *  Copyright (c) 2010-2011 Tobias Platen
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
#ifndef IMAGELOADERMACHO_H
#define IMAGELOADERMACHO_H

	class ImageLoaderMachO : public ImageLoader
	{
		mach_header* mach_hdr;
		int ndylibs;
		ImageLoader** dylibs;
		struct symtab_command* symtab;
	        struct dysymtab_command* dysymtab;
		public:
		virtual int loadDylibs();
		virtual int link();
		virtual std::string getFilename();
		virtual std::string getInstallname();
		virtual void* loadThread();
		struct segment_command* getSegment(char* segname);
		ImageLoader* loadDylib(struct dylib_command* dylib);
		int link_section(struct section* sect,int size,void (*bindfunc)(void*,void*));
		void* getImportedDylibSymbolAddress(char* sym);
		virtual void* getExportedSymbolAddress(char*);
		ImageLoaderMachO(int fd,int fa_offset,int fa_size,int nsegments,struct segment_command** segments,uint32_t type,uint32_t flags);
		//TODO objc
		//TODO entry
	};



#endif

